package it.unicam.cs.cosy.bioshape.core.components;


import it.unicam.cs.cosy.bioshape.core.util.Parameters;

import java.io.Serializable;

import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

/**
 * Describes the generic simulation entity in terms of {@code mass}, number of
 * real <i>instances</i> in the simulation space and positions of their centers.
 * Information about the {@code Entity} shape, i.e. its geometric
 * representation, is demanded to the implementing class.
 * 
 * @author Federico Buti
 */
public interface ProtoEntity extends Serializable {

	/**
	 * Add the centre of an instance of this {@code ProtoEntity} to the set of
	 * the centres.
	 * 
	 * @param center
	 *            {@code Vector3d} representing the centre of an
	 *            <i>instantiation</i> of such {@code ProtoEntity}
	 * @param rotation
	 *            {@code Vector3d} representing the rotation on the principal
	 *            axes to be applied to a specific instance
	 */
	public void addCenterAndRotation(Vector3d center, Vector3d rotation);

	/**
	 * @return the bounding box dimensions for this {@code EntityData}
	 */
	public Point3d getBB();

	/**
	 * The volume of the entity Bounding Box, a 3D parallelepiped who contains
	 * entirely the entity.
	 * 
	 * @return the entityVolume
	 */
	public double getBBVolume();

	/**
	 * @return the number of real {@code Entity} objects that must be instanced
	 *         in the simulation
	 */
	public int getCardinality();

	/**
	 * 
	 * @return this centre
	 */
	public Vector3d[] getCenters();

	/**
	 * @return The mass associated to this {@code EntityData}
	 */
	public double getMass();

	/**
	 * 
	 * @return the PolyTree name
	 */
	public String getName();

	/**
	 * @return this orientation
	 */
	public Vector3d[] getOrientations();

	/**
	 * 
	 * @param index
	 *            index of the center to return
	 * @return this center
	 */
	public Vector3d getCenter(int index);

	/**
	 * 
	 * @param index
	 *            index of the rotation to return
	 * @return this centre
	 */
	public Vector3d getOrientation(int index);

	/**
	 * Sets the {@code ShapedEntity} of this {@code ProtoEntity} so that its
	 * <i>internal</i> behaviour will be chosen as the default behaviour.
	 * 
	 * @param classString
	 *            Fully qualified name of the class to be used
	 */
	public void setEntityClass(String classString);

	/**
	 * Sets the type of the bounding volume to use. Currently the software
	 * supports AABB and spheres. Other bounds can be derived from the
	 * {@code Bounds} class.
	 * 
	 * @param boundsType the type of the bounding volume
	 */
	public void setBoundsType(String boundsType);

	/**
	 * Sets the driving object for the entity. Different drivers can be
	 * associated to an entity resulting in different behaviours.
	 * @param parameters TODO
	 * @param pathOfClassFile TODO
	 */
	public void setInputDriverInformation(Parameters parameters, String pathOfClassFile);

	/**
	 * @return radius The radius of the {@code ProtoEntity}
	 */
	public double getradius();

	/**
	 * Generates an instance of {@code Entity} class on the basis of the data
	 * collected in this {@code ProtoEntity} object. The passed id is provided
	 * by the {@code LocalCoordinator} whereas the centre is one of the centres
	 * contained in the {@code ProtoEntity} object itself.
	 * 
	 * @param id
	 *            identifier of the entity to create.
	 * @param center
	 *            initial position of the entity.
	 * @return the generated {@code Entity} object
	 */
	public Entity generateEntity(long id, Vector3d center);
}
